<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      template="/web/layout/arearestrita.xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"> 
	
	<ui:define name="bodyPrincipal">
		<p:panel id="panelAreaRestritaNoticias" columns="2" style="border-width:0;width:100%">
			<f:facet name="header">
				<h:panelGrid columns="2" style="width:100%">
					<h:panelGrid style="width:100%;text-align:left">
						<h:outputText style="font-size:25px" value="NOTICIAS" />
					</h:panelGrid>
					<h:panelGrid style="width:100%;text-align:right">
						<p:commandLink value="NOVA" 
							action="#{noticiaBeanSession.novaNoticia}"  />	
					</h:panelGrid>
				</h:panelGrid>
			</f:facet>
					<p:dataTable id="dtAreaRestritaNoticias" paginator="true" rows="20"
					 	emptyMessage="Nenhuma noticia cadastrada" 
					 		style="text-align:center"
					 		value="#{noticiaBeanSession.noticiasList}" var="noticia">
						<p:column style="width:300px" headerText="Titulo" filterBy="#{noticia.titulo}" 
							filterMatchMode="contains">
							<p:commandLink action="#{noticiaBeanSession.abrirNoticiaSelecionado}">
								<h:outputText value="#{noticia.titulo}" />
								<f:setPropertyActionListener 
									target="#{noticiaBeanSession.noticiasSelecionada}" 
									value="#{noticia}" />
							</p:commandLink>
						</p:column>
						<p:column style="width:150px" headerText="Data">
							<h:outputText value="#{noticia.dataPublicacao}" >
								<f:convertDateTime type="date"/>
							</h:outputText>
						</p:column>
						<p:column style="width:100px" headerText="Ativa ?">
							<p:selectBooleanButton disabled="true" onLabel="SIM" offLabel="NAO" 
								value="#{noticia.ativo}" />
						</p:column>
					</p:dataTable>
		</p:panel>
	</ui:define>

</ui:composition>